﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="_4T.Default" %>

<%@ Register Assembly="PQTPager" Namespace="PQT" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainPlaceHolder" runat="server">
    <script type="text/javascript">
        SetCurrentMenu('liHome')
    </script>
    <form runat="server" id="form1">
        <script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
        <script type="text/javascript">
            function setupvideo(videoid, url) {
                var tmp = "#" + videoid;
                if ($(tmp).length > 0) {
                    jwplayer(videoid).setup({
                        width: 250,
                        height: 200,
                        file: url
                    });
                }
            }

            function DeleteProfile(obj) {
                if (confirm('Bạn có chắc muốn xóa hồ sơ này?')) {
                    var profileCode = obj.name;
                    $.ajax(
                    {
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "Default.aspx/DeleteProfile",
                        data: JSON.stringify({ 'profileCode': profileCode }),
                        dataType: "json",
                        success: function (obj) {
                            window.location.reload(true);
                        },
                        error: function () { }
                    });
                }

            }

            $(document).ready(function () {
                var clicked = false;
                $('.btnAddComment').click(function () {
                    if (clicked == false) {
                        clicked = true;
                        $body = $(this).prev();
                        $bodyContent = $body.val();
                        $.ajax({
                            type: "POST",
                            contentType: "application/json; charset=utf-8",
                            url: "../ServiceAjax.svc/SaveComment",
                            data: JSON.stringify({
                                'body': $bodyContent,
                                'profileCode': this.getAttribute("profileCode"),
                                'stage': this.getAttribute("stage"),
                            }),
                            dataType: "json",
                            success: function (Text) {
                                if (Text.d == "successful")
                                    alert("Đã thêm bình luận");
                                else
                                    alert("Không đủ quyền truy cập");
                            },
                            error: function () {
                                alert("Xảy ra lỗi trong quá trình quản lý");
                            },
                            complete: function (jqXHR, textStatus) {
                                clicked = false;
                            }
                        })
                        $body.val("");
                    }
                });
            });
        </script>
        <script type="text/javascript">
            /*function showhideDetail(detailID) {
                if (document.getElementById(detailID).style.display == "block") {
                    document.getElementById(detailID).style.display = "none"
                }
                else {
                    document.getElementById(detailID).style.display = "block"
                }
            }*/
        </script>
        <section class="grid_12" style="width: 98%">
			<div class="block-border"><div class="block-content form">
				<h1>Danh sách hồ sơ</h1>
				<div class="block-controls">
					
					<%--<div class="controls-buttons">--%>
						<%--<li><a href="#" title="Previous"><img src="images/icons/fugue/navigation-180.png" width="16" height="16"> Prev</a></li>
						<li><a href="#" title="Page 1"><b>1</b></a></li>
						<li><a href="#" title="Page 2" class="current"><b>2</b></a></li>
						<li><a href="#" title="Page 3"><b>3</b></a></li>
						<li><a href="#" title="Page 4"><b>4</b></a></li>
						<li><a href="#" title="Page 5"><b>5</b></a></li>
						<li><a href="#" title="Next">Next <img src="images/icons/fugue/navigation.png" width="16" height="16"></a></li>--%>
					    <cc1:PQTPager ID="PQTPager1" runat="server" 
                            FirstPageText='First' 
                            LastPageText='Last'
                            PreviousButtonText="<" NextButtonText=">" 
                            PagerButtonCount="5" PageSize="5" 
                            onpageindexchanged="PQTPager1_PageIndexChanged" CssClass="controls-buttons cpos_r" />
					<%--</div>--%>
					<div class="clear"></div>
				</div>
				<table class="table sortable" cellspacing="0" width="100%">
				
					<thead>
						<tr>
                            <th scope="col">Số Hồ sơ</th>
                            <th scope="col">Sơ tuyển</th>
                            <th scope="col">Xác minh</th>
                            <th scope="col">Phê duyệt</th>
                            <th scope="col">Thanh toán</th>
                            <th scope="col">Action</th>
						</tr>
					</thead>
					
					<tbody>						
						<asp:Repeater ID="rptProfileList" runat="server" 
                                OnItemDataBound="rptProfileList_ItemDataBound">
                            <ItemTemplate>
                            <tr valign="top">
                            <td style="width: 8%">
                                <a href="Index.aspx?id=<%#Eval("ProfileCode") %>"><span style="text-decoration:underline;"><%#Eval("ProfileCode") %></span></a><br />
                                <asp:HyperLink runat="server" ID="LinkUserAction"><span style="text-decoration:underline;"><asp:Label runat="server" ID="UserAction"></asp:Label></span></asp:HyperLink>
                                <span ID="ProfileIsDeleted" runat="server" style="color:red;font-weight:bold">Hồ sơ đã xóa</span>
                            </td>
                            <td style="width: 21%" id="tdFilter" runat="server">
                                <div runat="server" id="divFilter" style="display: none;">
                                    <span class="title">Đề xuất:</span> <asp:Label runat="server" ID="lbProposeDate"></asp:Label><br />
                                    <span class="title">Sơ tuyển:</span> <asp:Label runat="server" ID="lbFilterDate"></asp:Label><br />
                                    <!-- <span class="spanDetail" onclick="showhideDetail('divFilterDetail<%//#Eval("ProfileCode") %>')">Chi tiết sơ tuyển</span> -->
                                    <div id="divFilterDetail<%#Eval("ProfileCode") %>" class="divDetail" style="display:none;">
                                    <asp:Label ID="lbFilterContent" runat="server"></asp:Label><br />
                                    <div id="videoFilter<%#Eval("ProfileCode") %>"></div>
                                    </div>
                                    <br />
                                    <br />
                                    <span class="title">Người sơ tuyển:</span> <asp:Label runat="server" ID="lbFilterer"></asp:Label><br />
                                </div><br /><br />
                                <!-- Comment -->		
                                <div style="display:none;" id="FrameCommentFilter" runat="server">
                                    <div class="task with-legend">
                                        <div class="legend"><img src="images/icons/fugue/flag.png" width="16" height="16"> Bình luận</div>
                                        <ul class="task-dialog">
                                            <asp:Repeater runat="server" ID="rptCommentFilter">
                                                <ItemTemplate>
                                                    <li>
                                                        <span style="margin: 0 5px;"><strong><%#Eval("CommentBy") %>:</strong></span><%#Eval("Body") %><span style="margin: 0 5px;text-transform: lowercase;"><em>vào lúc <%#Eval("CreatedDate") %></em></span></li>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                            <li runat="server" id="CommentFormFilter" style="display:none">
                                                <form name="task-1-comment" method="post" action="" class="form input-with-button">
                                                    <input type="text" name="comment" value="" title="Enter comment...">
                                                    <input id="Button2" runat="server" class='btnAddComment' type="button" stage='<%#Eval("Stage") %>' profileCode ='<%#Eval("ProfileCode") %>' value="Bình luận" />
                                                </form>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <!-- End Comment -->

                            </td>
                            <td style="width: 21%" id="tdVerify" runat="server">
                            <div runat="server" id="divVerify" style="display: none;">
                                <span class="title">Xác minh:</span> <asp:Label runat="server" ID="lbVerifyDate"></asp:Label><br />
                                <span class="title">Kết quả xác minh:</span> <asp:Label runat="server" ID="lbVerifyResult"></asp:Label><br />
                                <!-- <span class="spanDetail" onclick="showhideDetail('divVerifyDetail<%//#Eval("ProfileCode") %>')">Chi tiết xác minh</span> -->
                                    <div class="divDetail" id="divVerifyDetail<%#Eval("ProfileCode") %>" style="display:none;">
                                    <asp:Label ID="lbVerifyContent" runat="server"></asp:Label>
                                <div id="videoVerify<%#Eval("ProfileCode") %>"></div>
                                </div>                                
                                <br />
                                <br />
                                <span class="title">Người xác minh:</span> <asp:Label runat="server" ID="lbVerifier"></asp:Label><br />
                                </div><br /><br />
                                <!-- Comment -->		
                                <div style="display:none;" id="FrameCommentVerifier"  runat ="server">
                                    <div class="task with-legend">
                                        <div class="legend"><img src="images/icons/fugue/flag.png" width="16" height="16"> Bình luận</div>
                                        <ul class="task-dialog">
                                            <asp:Repeater runat="server" ID="rptCommentVerifier">
                                                <ItemTemplate>
                                                    <li>
                                                        <span style="margin: 0 5px;"><strong><%#Eval("CommentBy") %>:</strong></span><%#Eval("Body") %><span style="margin: 0 5px;text-transform: lowercase;"><em>vào lúc <%#Eval("CreatedDate") %></em></span></li>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                            <li runat="server" id="CommentFormVerifier" style="display:none">
                                                <form name="task-1-comment" method="post" action="" class="form input-with-button">
                                                    <input type="text" name="comment" value="" title="Enter comment...">
                                                    <input id="Button1" runat="server" class='btnAddComment' type="button" stage='<%#Eval("Stage") %>' profileCode ='<%#Eval("ProfileCode") %>' value="Bình luận" />
                                                </form>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <!-- End Comment -->
                            </td>
                            <td style="width: 21%" id="tdApprove" runat="server">
                            <div runat="server" id="divApprove" style="display: none;">
                                <span class="title">Phê duyệt:</span> <asp:Label runat="server" ID="lbApproveDate"></asp:Label><br />
                                <span class="title">Hỗ trợ:</span> <asp:Label runat="server" ID="lbMoney"></asp:Label><br />
                                <!-- <span class="spanDetail" onclick="showhideDetail('divApproveDetail<%//#Eval("ProfileCode") %>')">Chi tiết phê duyệt</span> -->
                                    <div class="divDetail" id="divApproveDetail<%#Eval("ProfileCode") %>" style="display:none;">
                                    <asp:Label ID="lbApproveContent" runat="server"></asp:Label>
                                        <div id="videoApprove<%#Eval("ProfileCode") %>"></div>
                                    </div>
                                    <br />
                                    <br />
                                <span class="title">Người duyệt:</span> <asp:Label runat="server" ID="lbApprover"></asp:Label><br />
                                </div><br /><br />
                                <!-- Comment -->		
                                <div  style="display:none;" id="FrameCommentApprove"   runat ="server">
                                    <div class="task with-legend">
                                        <div class="legend"><img src="images/icons/fugue/flag.png" width="16" height="16"> Bình luận</div>
                                        <ul class="task-dialog">
                                            <asp:Repeater runat="server" ID="rptCommentApprove">
                                                <ItemTemplate>
                                                    <li>
                                                        <span style="margin: 0 5px;"><strong><%#Eval("CommentBy") %>:</strong></span><%#Eval("Body") %><span style="margin: 0 5px;text-transform: lowercase;"><em>vào lúc <%#Eval("CreatedDate") %></em></span></li>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                            <li runat="server" id="CommentFormApproval" style="display:none">
                                                <form name="task-1-comment" method="post" action="" class="form input-with-button">
                                                    <input type="text" name="comment" value="" title="Enter comment...">
                                                    <input runat="server" class='btnAddComment' type="button" stage='<%#Eval("Stage") %>' profileCode ='<%#Eval("ProfileCode") %>' value="Bình luận" />
                                                </form>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <!-- End Comment -->
                            </td>
                            <td style="width: 21%" id="tdPayment" runat="server">
                                <div runat="server" id="divPayment" style="display: none;">
                                    <span class="title">Thanh toán:</span> <asp:Label runat="server" ID="lbPaymentDate"></asp:Label><br />
                                    <span class="title">Số tiền thanh toán:</span> <asp:Label runat="server" ID="lbPaymentAmount"></asp:Label><br />
                                    <!-- <span class="spanDetail" onclick="showhideDetail('divPaymentDetail<%//#Eval("ProfileCode") %>')">Chi tiết thanh toán</span> -->
                                    <div class="divDetail" id="divPaymentDetail<%#Eval("ProfileCode") %>" style="display:none;">
                                    <asp:Label ID="lbPaymentContent" runat="server"></asp:Label>
                                    <div id="videoPayment<%#Eval("ProfileCode") %>"></div>
                                    </div>
                                    <br />
                                    <br />
                                    <span class="title">Người thanh toán:</span> <asp:Label runat="server" ID="lbPaymentPerson"></asp:Label><br />
                                </div>
                            </td>
                            <td style=" width:8%;" id="tdAction" runat="server" class="table-actions">
                                <div runat="server" id="divAction" style=" display:none;">
                                    <a href="#" title="Edit" class="with-tip" ><img src="images/icons/fugue/pencil.png" width="16" height="16"></a>
								    <a href="#" title="Delete" name='<%#Eval("ProfileCode") %>' class="with-tip" onclick="javascript:DeleteProfile(this);return false;"><img src="images/icons/fugue/cross-circle.png" width="16" height="16"></a>
                                </div>
                            </td>
                            </tr>                
                            </ItemTemplate>
                        </asp:Repeater>						
					</tbody>
				</table>					
			</div></div>
		</section>
    </form>
</asp:Content>
